package com.jiulan.hearthearing.ui.news.adapter;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.jiulan.hearthearing.R;
import com.jiulan.hearthearing.ui.news.model.NewsListModle;
import com.shehuan.niv.NiceImageView;

import java.util.List;

public class NewsAdapter extends BaseQuickAdapter<NewsListModle.DataBean, BaseViewHolder> {

    public NewsAdapter(List<NewsListModle.DataBean> data) {
        super(R.layout.item_news, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, NewsListModle.DataBean item) {
        NiceImageView nivPic = helper.getView(R.id.nivPic);
        Glide.with(mContext).asBitmap().load(item.getImage()).override(85, 85).centerCrop().into(nivPic);
        helper.setText(R.id.tvTitle, item.getTitle());
        helper.setText(R.id.tvContent, item.getSynopsis());
        helper.setText(R.id.tvTime, item.getAdd_time());
        helper.setText(R.id.tvCheckNum, String.valueOf(item.getView()));
        helper.setText(R.id.tvShareNum, String.valueOf(item.getShare_num()));
        helper.addOnClickListener(R.id.tvSign);
    }
}
